MRC OCR API
Objective
The Motor Registration Certificate(MRC) OCR API verifies and extracts information from the user's Vietnamese MRC.
| Input | Output |
|---|---|
| An image or PDF file containing a user's MRC | An array containing detailed information extracted from the document |
API Endpoint
readMRC
Overview
The API is RESTful and uses standard HTTP verbs and status codes. The responses are in JSON format and you should upload all images and files as form-data through a POST request.
Authentication
You need a unique pair of application ID (appId) and application key (appKey) from HyperVerge to verify your identity for accessing the API.
API Request Details
Method - POST
Headers
| Parameter | Mandatory or Optional | Description | Allowed Values |
|---|---|---|---|
| content-type | Mandatory | This parameter defines the media type for the request payload | application/json |
| appId | Mandatory | The application identifier shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value |
| appKey | Mandatory | The application key shared by HyperVerge. You can find the details in the dashboard's credentials tab. | This should be a unique value |
| transactionId | Mandatory | A unique identifier for tracking a user journey | This should be both unique and easily associated with the user's journey in your application(s) |
Inputs
The following table provides the complete information on the parameters used in the request body for the API calls.
| Parameter | Description | Mandatory or Optional | Allowed Values | Default Value |
|---|---|---|---|---|
image1 | The parameter accepts either an image or a pdf file containing the user's MRC | Mandatory | Image(JPG,JPEG and PNG) or PDF File | Not Applicable |
image2 | The parameter accepts either an image or a pdf file containing the user's MRC | Optional | Image(JPG,JPEG and PNG) or PDF File | Not Applicable |
dateFirstRegistration | This parameter represents the date of the first registration related to the document being processed | Mandatory | Data Type:String Format:DD/MM/YYYY | Not Applicable |
dateCurrentRegistration | This parameter repersents the date of the most recent registration pertaining to the document being processed | Mandatory | Data Type:String Format:DD/MM/YYYY | Not Applicable |
name | This parameter refers to the full name of the user | Mandatory | Data Type:String | Not Applicable |
Sample Request
The following code shows a standard cURL request for the API.
curl --location --request POST 'https://apac.docs.hyperverge.co/v1/readMRC' \
--header 'Content-Type: multipart/form-data' \
--header 'appId: <Enter_the_HyperVerge_appId>' \
--header 'appKey: <Enter_the_HyperVerge_appKey>' \
--header 'transactionId: <Enter_the_HyperVerge_transactionID>' \
--form 'image1=@"<path_to_image1>"' \
--form 'image2=@"<path_to_image2>"' \
--form 'dateFirstRegistration="<Enter_the_dateFirstRegistration>"' \
--form 'dateCurrentRegistration="<Enter_the_dateCurrentRegistration>"' \
--form 'name="<Enter_the_name>"'
Success Response Sample
The following is a sample of a success response from the API.
{
"status": "success",
"statusCode": "200",
"result": [
{
"type": "mrc_back",
"details": {
"name": {
"to-be-reviewed": "yes",
"value": "<Name_of_the_Individual>",
"conf": 0.4914,
},
"year-current-registration": {
"to-be-reviewed": "no",
"value": "<Year_of_Current_Registration>",
"conf": 1,
},
"price": {
"to-be-reviewed": "yes",
"value": "<Price_Value>",
"conf": 0.6,
},
"<Other_Fields>": "<Other_Values>",
"verified": {
"year-first-registration": "<True_or_False>",
"month-first-registration": "<True_or_False>",
"name": "<True_or_False>",
"month-current-registration": "<True_or_False>",
"year-current-registration": "<True_or_False>",
}
}
},
{
"type": "mrc_front",
"details": {
"mrc-number": {
"to-be-reviewed": "no",
"value": "<MRC_Number>",
"conf": 1,
}
}
}
],
"requestId": "<Request_ID>"
}
Success Response Details
| Parameter | Type | Description |
|---|---|---|
| name | object | The name details |
| name.to-be-reviewed | string | Indicates if the name field is to be reviewed |
| name.value | string | The value of the name |
| name.conf | float | The confidence level of the name |
| year-current-registration | object | The year of current registration details |
| year-current-registration.to-be-reviewed | string | Indicates if the year-current-registration field is to be reviewed |
| year-current-registration.value | string | The value of the year of current registration |
| year-current-registration.conf | float | The confidence level of the year of current registration |
| price | object | The price details |
| price.to-be-reviewed | string | Indicates if the price field is to be reviewed |
| price.value | integer | The value of the price |
| price.conf | float | The confidence level of the price |
| verified | object | Verification details for various fields |
| verified.year-first-registration | boolean | Verification status for the year of first registration |
| verified.month-first-registration | boolean | Verification status for the month of first registration |
| verified.name | boolean | Verification status for the name |
| verified.month-current-registration | boolean | Verification status for the month of current registration |
| verified.year-current-registration | boolean | Verification status for the year of current registration |
| mrc-number | object | The MRC number details |
| mrc-number.to-be-reviewed | string | Indicates if the MRC number field is to be reviewed |
| mrc-number.value | string | The value of the MRC number |
| mrc-number.conf | float | The confidence level of the MRC number |
Failure Response Samples
- Empty Response
- Input Error
# If MRC could not be detected in the image, following response is received
{
"status": "success",
"statusCode": "200",
"result": [],
"requestId": "<Request_ID>"
}
{
"status": "failure",
"statusCode": "400",
"error": "API call requires atlest one input image"
}
Error Response Samples
- Rate Limit Exceeded
- Internal Server Error
{
"status": "failure",
"statusCode": 429,
"error": "Rate limit exceeded"
}
The following is a sample response for a server error.
{
"message": "Internal Server Error",
"statusCode": 500,
"status": "failure"
}
Failure and Error Response Details
A failure or error response from the module contains a
failure status, with a relavant status code and error message. The following table lists all error responses. | Status Code | Error Message | Error Description |
|---|---|---|
| 400 | API call requires at least one input image | This error is returned when image is not sent in the API call |
| 400 | API call handles only upto 2 images | This error is returned when more than 2 images are sent in the API call |
| 400 | image size cannot be greater than 6MB | The maximum size of input image is 6MB. Crossing this will result in this error |
| 429 | Rate limit exceeded | You have exceeded the configured limit on the number of transactions permitted in a minute. Please contact the HyperVerge team for resolution |
| 500/501 | Internal Server Error | Please check the request headers or contact the HyperVerge team for resolution |
| 503 | Server busy | Please contact the HyperVerge team for resolution |